﻿''' <summary>
''' 用户操作日志类型
''' </summary>
''' <remarks></remarks>
Public Enum tbccLogOperateType
    Login = 10
    'Logout
    ChangePassword
    UserManage
    ShutDown

    View = 20
    ViewRealtimeData
    ViewHistorydata

    ModifyParameter = 30
    ModifyProject

    Connect = 40
    DisConnect
    Callback
End Enum

''' <summary>
''' 操作类型实体类
''' </summary>
''' <remarks></remarks>
Public Class OperateTypeItem

    Sub New()
        _opID = ""
        _opName = ""
    End Sub

    Sub New(ByVal id As String)
        MyClass.New()

        Dim obj As Object
        obj = System.Enum.Parse(GetType(tbccLogOperateType), id)
        If obj IsNot Nothing Then
            _opID = System.Enum.GetName(GetType(tbccLogOperateType), obj)
            _opName = GetName(obj)
        End If
    End Sub

    Sub New(ByVal opType As tbccLogOperateType)
        _opID = System.Enum.GetName(GetType(tbccLogOperateType), opType)
        _opName = GetName(opType)
    End Sub

    Private _opID As String
    Public ReadOnly Property opID() As String
        Get
            Return _opID
        End Get
    End Property

    Private _opName As String
    Public Property opName() As String
        Get
            Return _opName
        End Get
        Set(ByVal value As String)
            _opName = value
        End Set
    End Property

    Public Overrides Function ToString() As String
        Return opName
    End Function

    Public Shared Function GetName(ByVal opType As tbccLogOperateType) As String
        Dim opName As String = ""
        Select Case opType
            Case tbccLogOperateType.Login
                opName = "登陆"
            Case tbccLogOperateType.ChangePassword
                opName = "修改密码"
            Case tbccLogOperateType.UserManage
                opName = "用户管理"
            Case tbccLogOperateType.ShutDown
                opName = "退出系统"

            Case tbccLogOperateType.View
                opName = "查看"
            Case tbccLogOperateType.ViewRealtimeData
                opName = "查看实时数据"
            Case tbccLogOperateType.ViewHistorydata
                opName = "查看历史数据"

            Case tbccLogOperateType.ModifyParameter
                opName = "修改参数"
            Case tbccLogOperateType.ModifyProject
                opName = "工程配置"

            Case tbccLogOperateType.Connect
                opName = "连接"
            Case tbccLogOperateType.DisConnect
                opName = "断开"
            Case tbccLogOperateType.Callback
                opName = "重连"


            Case Else
                opName = ""
        End Select

        Return opName
    End Function
End Class



